import type { RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'

// 静态路由
const constantRoute: RouteRecordRaw[] = [
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'login', // 命名路由
    meta: {
      hidden: true,
    },
  },
  {
    path: '/',
    redirect: '/home',
    component: Layout,
    name: 'Layout',
    meta: {
      title: 'Layout',
    },
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index.vue'),
        name: 'home', // 命名路由
        meta: {
          title: '首页',
          icon: 'ChromeFilled',
        },
      },
    ],
  },
  {
    path: '/childMicroApp/system',
    redirect: '/childMicroApp/system/user',
    component: Layout,
    meta: {
      title: '系统信息',
      icon: 'Files',
    },
    children: [
      {
        path: '/childMicroApp/system/user',
        component: () => import('@/views/home/index.vue'),
        name: 'SystemUser', // 命名路由
        meta: {
          title: '用户管理',
          icon: 'User',
        },
      },
      {
        path: '/childMicroApp/system/role',
        component: () => import('@/views/system/role/index.vue'),
        name: 'SystemRole', // 命名路由
        meta: {
          title: '角色管理',
          icon: 'List',
        },
      },
      {
        path: '/childMicroApp/system/menu',
        component: () => import('@/views/system/menu/index.vue'),
        name: 'SystemMenu', // 命名路由
        meta: {
          title: '菜单管理',
          icon: 'Menu',
        },
      },
    ],
  },
  {
    path: '/divide',
    redirect: '/divide/role',
    component: Layout,
    meta: {
      title: '权限分配',
      icon: 'MessageBox',
    },
    children: [
      {
        path: '/divide/role',
        component: () => import('@/views/divide/role/index.vue'),
        name: 'DivideUser', // 命名路由
        meta: {
          title: '角色分配',
          icon: 'Avatar',
        },
      },
      {
        path: '/divide/menu',
        component: () => import('@/views/divide/menu/index.vue'),
        name: 'DivideMenu', // 命名路由
        meta: {
          title: '菜单分配',
          icon: 'Grid',
        },
      },
    ],
  },
  {
    path: '/404',
    component: () => import('@/views/404/index.vue'),
    name: '404', // 命名路由
    meta: {
      hidden: true,
    },
  },
]
export { constantRoute }
